/*
	PlAr is Platform Arena: a 2D multiplayer shooting game
	Copyright (c) 2010, Antonio Ragagnin <spocchio@gmail.com>
    All rights reserved.
*/

package plar.core;

/*
PlAr is Platform Arena: a 2D multiplayer shooting game
Copyright (c) 2010, Antonio Ragagnin <spocchio@gmail.com>
*/
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.World;

import plar.core.Action;

/**
 * Set a force opposite to the gravity of the level, is used to keep a body in uniform motion
 * JBox2D offers the KINEMATIK body type but it don't handle Collisions with STATICb bodies.
 *
 * @author Antonio Ragagnin
 *
 */

public class ActionNoGravity extends Action {


    public void run() {


        World w = me.body.getWorld();
        Vec2 menog = w.getGravity().clone();

        menog.x=-menog.x*me.body.getMass();
        menog.y=-menog.y*me.body.getMass();

        me.body.applyForce(menog,me.body.getWorldCenter());
    }

}
